package com.iteaj.iot.client;

import com.iteaj.iot.ProtocolTimeoutManager;
import com.iteaj.iot.builder.AbstractBuilder;
import com.iteaj.iot.builder.Builder;
import com.iteaj.iot.builder.ComponentBuilder;
import com.iteaj.iot.codec.filter.DecoderFilter;

/**
 * 客户端组件构建器
 * @see ClientComponent
 */
public class ClientBuilder extends AbstractBuilder<ClientComponent, ClientEventListener> {

    protected ClientBuilder() { }

    public static ClientBuilder builder() {
        return new ClientBuilder();
    }

    @Override
    public Builder listener(ClientEventListener listener) {
        return this.setListener(listener);
    }

    @Override
    public ComponentBuilder<ClientProtocolHandle, DecoderFilter> register(ClientComponent component) {
        return new ComponentBuilder(component, this);
    }

    @Override
    public ClientBuilder customize(ProtocolTimeoutManager timeoutManager) {
        return (ClientBuilder) this.setTimeoutManager(timeoutManager);
    }
}
